package com.quasar.hpatient.presenter;
import com.quasar.hpatient.model.medicalmodel.PrescriptionDayData;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnSelectPrescriptionListener;
import com.vise.log.ViseLog;

/**
 * author : 许建宏
 * Date: 2017/11/16 0016
 * View:
 */

public class SelectPrescriptionPresenter {

    private RequestModel requestModel;
    private OnSelectPrescriptionListener testrecordView;

    public SelectPrescriptionPresenter(OnSelectPrescriptionListener testrecordView) {
        this.requestModel = new RequestModel();
        this.testrecordView = testrecordView;
    }

    //获取当前药单信息
    public void AtPrescription(){

        requestModel.GetPatientSinglePrescrptionDetail2Data(new AnotherResultListener<PrescriptionDayData>() {
            @Override
            public void onSuccess(PrescriptionDayData data) {
                testrecordView.onPrescriptionDaySuccess(data);
            }

            @Override
            public void onError(String msg) {
                testrecordView.onError(msg);
                ViseLog.d("我的药单"+msg);
            }

            @Override
            public void onRefreshUI() {
                testrecordView.onRefreshUI();
            }
        });
    }

    /**
     * 历史药单列表
     */
    public void GetPatientSinglePrescrptionDetailData(String page){

        requestModel.GetPatientSinglePrescrptionDetail("", "",page, new AnotherResultListener<PrescriptionDayData>() {
            @Override
            public void onSuccess(PrescriptionDayData data) {
                testrecordView.onSeccessHistory(data);
            }

            @Override
            public void onError(String msg) {
                testrecordView.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                testrecordView.onRefreshUI();
            }
        });
    }

}
